package com.cellulam.framework.mq.send;

import com.aliyun.openservices.ons.api.Message;
import com.aliyun.openservices.ons.api.ONSFactory;
import com.aliyun.openservices.ons.api.Producer;
import com.aliyun.openservices.ons.api.SendResult;
import lombok.extern.slf4j.Slf4j;

import java.util.Properties;

/**
 * 普通消息发送
 */
@Slf4j
public class MqMessageSender extends BaseAbstractMessageSender<Producer> {
    public MqMessageSender(String groupId, String topic) {
        super(groupId, topic);
    }

    @Override
    protected final Producer createProducer(Properties properties) {
        return ONSFactory.createProducer(properties);
    }

    @Override
    protected final SendResult send(Message message) {
        return this.getProducer().send(message);
    }
}
